package by.grsu.shedule;

import by.grsu.shedule.api.SheduleAPI;
import by.grsu.shedule.common.CommonApplication;
import by.grsu.shedule.database.ImportantLessonManager;
import by.grsu.shedule.database.SheduleManager;

public class SheduleApplication extends CommonApplication {

	private SheduleManager sheduleManager;

	private ImportantLessonManager importantLessonManager;

	@Override
	public void onCreate() {
		super.onCreate();
		sheduleManager = new SheduleManager(getApplicationContext());
		importantLessonManager = new ImportantLessonManager(
				getApplicationContext());
		SheduleAPI.newInstance(getApplicationContext());
	}

	@Override
	public Object getSystemService(String name) {
		if (name.equals(SheduleManager.SHEDULE_MANAGER)) {
			return sheduleManager;
		}
		if (name.equals(ImportantLessonManager.IMPORTANT_LESSON_MANAGER)) {
			return importantLessonManager;
		}
		return super.getSystemService(name);
	}

}
